import { exec as debug } from "./debug.js";
import { exec as config } from "./config.js";
import { exec as login } from "./login.js";
import { exec as doc } from "./doc.js";
import { exec as ocr } from "./ocr.js";
import { exec as gw_login, captcha as gw_captcha } from "./gw-login.js";


function command(cmds, path) {
    console.log('指令:  ' +  cmds);
    console.log('代码执行的路径:  ' + path);
    if (cmds.length <= 0) {
      return;
    }
    const type = cmds.shift();
    if (type === 'config') {
	    config(cmds);
    } else if (type === 'doc') {
      if (type === 'doc') {
        doc(cmds, path);
      } else {
        console.log(`${type}指令不存在`);
      }
    } else if (type === 'login') {
		  login(cmds);
    } else if (type === 'debug') {
		  debug(cmds);
    } else if (type === 'ocr') {
		  ocr(cmds);
    } else if (type === 'gw-login') {
		  gw_login(cmds);
    } else if (type === 'gw-captcha') {
		  gw_captcha(cmds);
    } else {
      console.log('该指令不存在');
    }
}

export {
    command
}
